package com.fqgj.sentry.policy.engine.eval.script

def jsonForParsing = [tongdunData1:'{"互联网金融门户":1,"一般消费分期平台":8,"银行消费金融公司":1,"财产保险":1,"小额贷款公司":17,"第三方服务商":1,"P2P网贷":21,"大型消费金融公司":1}']

def normalVar = [var1:2]
Map inputVar = [
        *:jsonForParsing,
        *:normalVar
]

def script = '''
    def tongdunData = parseJson(tongdunData1)
    def a = sum(tongdunData.互联网金融门户, tongdunData.一般消费分期平台, tongdunData.小额贷款公司, var1)
    sum(a, '1','2')
'''

assert ScriptEval.eval(inputVar, script) == 31
